<template>
  <div>
    <div class="header">
      <div class="header_top">
        <img src="../../assets/images/返回.png" @click="fanhui" alt="" />
        <div style="color: #fff">选择客户</div>
        <img src="../../assets/images/fanhuishouye.png" alt="" />
      </div>
    </div>
  <div class="search">
      <van-search show-action placeholder="关键字查询">
        <template #action>
          <div style="color: #1f3695">搜索</div>
        </template>
      </van-search>
    </div>
    <div class="line" v-for="item in records" :key="item.id" @click="btn(item.custName,item.id)">
        <div class="line-box">
            <img src="../../assets/images/头像.png" width="60" alt="">
        <span style="margin-left:15px">{{item.custName}}</span>
        </div>
        <img class="imgSrc" src="../../assets/images/jiantou.png" alt="">
    </div>
  </div>
</template>

<script>
import {cust} from '../../request/api'
export default {
  data() {
    return {
        records:[]
    };
  },
  methods: {
    fanhui() {
      this.$router.back();
    },
    btn(name,id){
        this.$router.push({
          path: '/visitXZ',
          query: {
            name: name,
            id:id
          },
        })
    }
    
  },
  created(){
      cust({
          current:1,
          size:10
      }).then(res=>{
          if(res.errCode==0){
              console.log(res);
              let {records} = res.data
              this.records=records
          }
      })
  }
};
</script>
 
<style lang = "less" scoped>
.header {
  width: 100%;
  background: #1f3484;
  .header_top {
    padding: 31px 12px 15px;
    height: 22px;
    display: flex;
    justify-content: space-between;
    img {
      height: 100%;
    }
  }
}
.search {
  padding: 8px;
  box-sizing: border-box;
  background: #fff;
  border-bottom: 1px solid #e4e4e4;
  margin-bottom: 10px;
 
}
.van-search__content {
  border-radius: 20px;
}
.line{
    display: flex;
    align-items: center;
    background: #fff;
    padding: 10px;
    justify-content: space-between;
    border-bottom: 1px solid #999;
    .line-box{
        display: flex;
    align-items: center;
    }
}
</style>